// SKU管理模块的接口
import request from "@/utils/request";
import type { SkuInfoResData, SkuDetailResData } from "./types";

enum API {
    // 获取已有的商品数据-SKU
    SKUINFO_URL = '/admin/product/list/',
    // 商品上架
    ONSALE_URL = '/admin/product/onSale/',
    // 商品下架
    CANCELSALE_URL = '/admin/product/cancelSale/',
    // 商品详细信息接口
    SKUDETAIL_URL = '/admin/product/getSkuInfo/',
}

// 获取商品SKU的接口
export const reqSkuInfo = (page: number, limit: number): Promise<SkuInfoResData> => request({
    url: API.SKUINFO_URL + `${page}/${limit}`,
    method: 'GET'
})
// 商品上架接口
export const reqSkuOnSale = (skuId: number): any => request({
    url: API.ONSALE_URL + skuId,
    method: 'GET'
})
// 商品下架接口
export const reqSkuCancelSale = (skuId: number): any => request({
    url: API.CANCELSALE_URL + skuId,
    method: 'GET'
})
// 获取商品详细信息接口
export const reqSkuDetail = (skuId: number): Promise<SkuDetailResData> => request({
    url: API.SKUDETAIL_URL + skuId,
    method: 'GET'
})